import unittest
import time
import HTMLTestRunner
suite = unittest.TestSuite()
tests = unittest.defaultTestLoader.discover('.',pattern="test*.py")
suite.addTests(tests)
now = time.strftime("%Y%m%d %H%M%S",time.localtime())
reportFile="./"+now+"_result.html" # html 文件
fp= open(reportFile,'wb') # 文件流
runner= HTMLTestRunner.HTMLTestRunner(stream=fp, verbosity = 2, title='报告标题功 能测试报告', description='报告的说明与描述')
# runner = unittest.TextTestRunner(verbosity=2)
runner.run(suite)
